#ifndef __HX710C_H_
#define __HX710C_H_

#ifdef __cplusplus
extern "C" {
#endif
	
#include "Board.h"
#include "stdio.h"
#include "apm32f0xx_gpio.h"
#include "apm32f0xx_misc.h"
#include "apm32f0xx_eint.h"
#include "apm32f0xx_rcm.h"
#include "apm32f0xx_usart.h"
#include "delay.h"





enum _Cali         //水泵工作模式
{
		_Cali_start,           //正常     
		_Cali_no_water , 
    _Cali_no_water_finish , 
		_Cali_full_water,        // 没装滤芯
		_Cali_full_water_finish, 
	
		_Cali_Null                 
};
 


extern u8 Write_flag; 
extern u8 Calc_flag;
#define   HX710_GPIO_CLK      GPIOB 
#define   HX710_GPIO_DIO      GPIOB
#define   HX710_PIN_CLK      	GPIO_PIN_10 
#define   HX710_PIN_DIO       GPIO_PIN_11

#define   HX710_CLK_1    GPIO_SetBit(HX710_GPIO_CLK, HX710_PIN_CLK)
#define   HX710_CLK_0    GPIO_ClearBit(HX710_GPIO_CLK, HX710_PIN_CLK)
#define   HX710_DIO      GPIO_ReadInputBit(HX710_GPIO_DIO,HX710_PIN_DIO)

void Calc_flash(void);
void Write_K_B_clac(void);
void Read_B_K_Cali(void);
float Get_Weight_Calc(float K_Weight,float B_Weight); //测得实际的重量
void Weight_Calc_Start(void);
void Weight_Cali(void);
void HX710C_Init(void);
unsigned long HX710C_Read(void);
float Read_Weight(void);
float Get_Weight(void);       //测的水的重量
void Weight_calibration(u8 cal);   //校准时要用的函数
u8 Led_Weight_Check(void);
void Calc_Cali_Weight(void);
uint32_t Weight_flash_Read(void);
void Weight_flash_Save(u32 user_data,float K_data);

void drink_time_report(void);
void again_flash_Save(u32 user_data,float K_data);

void Judge_drink_weight(void);   //上报饮水量
	
#ifdef __cplusplus
}
#endif

#endif 
